package com.Isb.Golf.inputgolfscore;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import com.Isb.Golf.inputgolfscore.InputGolfScoreModel;

public class InputGolfScore extends Activity {

	private Button btn_history;
	private Button btn_input;
    private InputGolfScoreModel appModel;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_input_golf_score);
		findViews();
		setListeners();

		appModel = InputGolfScoreModel.getInstance();
		appModel.setContext(getApplicationContext());
		appModel.init(getApplicationContext());
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.input_golf_score, menu);
		return true;
	}

	@Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
        case R.id.action_settings:
            Intent intent = new Intent();
            intent.setClassName("com.Isb.Golf.inputgolfscore", "com.Isb.Golf.inputgolfscore.SettingActivity");
            intent.setAction(Intent.ACTION_VIEW);
            startActivity(intent);
        }
        return super.onOptionsItemSelected(item);
    }

	protected void findViews(){
		//history button
		btn_history = (Button)this.findViewById(R.id.history_button);
		btn_input = (Button)this.findViewById(R.id.input_button);
	}

	protected void setListeners(){
		btn_input.setOnClickListener(new OnClickListener(){
			public void onClick(View v){
				Intent intent = new Intent();
				intent.setClassName("com.Isb.Golf.inputgolfscore", "com.Isb.Golf.inputgolfscore.InputActivity");
				intent.setAction(Intent.ACTION_VIEW);
				startActivity(intent);
			}
		});

		btn_history.setOnClickListener(new OnClickListener(){
			public void onClick(View v){
			}
		});
	}


}
